package org.dbp.core.mock;

import java.beans.PropertyEditorSupport;
import java.text.NumberFormat;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import org.dbp.registros.propertysupport.CadenasDbpRegistro;
import org.dbp.registros.propertysupport.NumerosDbpRegistro;

public class RegistrosMock {

	private static RegistrosMock instancia=new RegistrosMock();
	
	public static RegistrosMock obtenerInstancia(){
		return instancia;
	}
	
	public Map<Class<?>,PropertyEditorSupport> cargarRegistrosPorDefecto(){
		return cargarRegistrosPorDefecto(new Locale("es","ES"));
	}
	
	public Map<Class<?>,PropertyEditorSupport> cargarRegistrosPorDefecto(Locale locale){
		Map<Class<?>,PropertyEditorSupport> definicionRegistros = new HashMap<Class<?>,PropertyEditorSupport>();
		definicionRegistros.put(String.class, new CadenasDbpRegistro());
	    NumberFormat numberFormat = NumberFormat.getInstance(locale);
	    numberFormat.setGroupingUsed(true);
	    definicionRegistros.put(Integer.class, new NumerosDbpRegistro(Integer.class, numberFormat, true));
	    definicionRegistros.put(Long.class, new NumerosDbpRegistro(Long.class, numberFormat, true));
	    return definicionRegistros;
	}
}
